<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/js/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css" />

        <script src="/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/jquery.form.js"></script>
        <script src="/dialog/js/dialog.js"></script>
        <script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/common.js"></script>
        <script src="/js/flatpickr.js"></script>

		<script type="text/javascript">
            function delete1(id) {
                $.ajax({
                    type:'post',
                    url:'delete',
                    data:{
                        id : id
                    },
                    success:function (data) {
                        if(data.code == 0){
                            window.location.reload();
                        }else{
                            alert("删除失败");
                        }
                    }
                });
            }

		</script>
	</head>

	<body>
		<!--顶部导航 -->
		<nav class="topNavItemBox">
			<div id="ItemBox">
				<div class="title">肉品溯源管理系统</div>
			</div>
		</nav>
		<!-- 左侧导航 -->
		<#include "left.ftl"/>
        <!--物流信息查询 -->

		<div class="page_main">
			<h3>物流信息管理</h3><span class="add_link"><a href="add">新增物流信息></a></span>
			<br />
			<div class="page_content">
				<h4>物流信息查询</h4>
				<br /><br />
				<form id="transportInfo_query" method="post" action="/admin/transitInfo/list">
					<label >物流批次编号</label><input type="text" name="batchId" value="${batchId}" class="commonInputtext" /><span></span>
					<label >物流公司</label><input type="text" name="compName" value="${compName}" class="commonInputtext" /><span></span>
					<input type="submit" value="查询" style="display: inline-block; margin-left: 30px;" />
				</form>
				<div>
					<table id="transport_table" class="table" width="100%">
						<thead>
							<tr>
								<th><input id="checkall" type="checkbox" /></th>
								<th width="100">物流编号</th>
								<th width="100">物流批次</th>
								<th width="100">路线</th>
								<th width="100">站点</th>
								<th width="100">生猪编号</th>
								<th width="100">产品编号</th>
								<th width="100">开始运输时间</th>
								<th width="100">结束运输时间</th>
								<th width="100">物流公司</th>
								<th width="100">检验结果</th>
								<th width="120">操作</th>
							</tr>
						</thead>
						<tbody>
							<#list page.list as vo>
								<tr>
									<th><input type="checkbox" value="${vo.transitInfo.gid}"/></th>
									<th width="100">${vo.transitInfo.gid}</th>
									<th width="100">${vo.transitBatchInfoVO.transitBatchInfo.transitBatchId}</th>
									<th width="100">${vo.transitBatchInfoVO.transportRouteInfor.routeName}</th>
									<th width="100">${vo.transitBatchInfoVO.transportRouteInfor.stationName}</th>
									<th width="100">${vo.purchaseInfo.gid}</th>
									<th width="100">${vo.transitInfo.productId}</th>
									<th width="100">${vo.transitBatchInfoVO.transitBatchInfo.startTime?string('yyyy-MM-dd hh:mm:ss')}</th>
									<th width="100">${vo.transitBatchInfoVO.transitBatchInfo.endTime?string('yyyy-MM-dd hh:mm:ss')}</th>
									<th width="100">${vo.transitBatchInfoVO.companyInfo.compname}</th>
									<th width="100">${vo.transitInfo.inspectResult}</th>
									<th width="120"><input type="button"  value="编辑"/><input type="button" value="删除" onclick="JavaScript:if(confirm(&apos;是否删除&apos;)) { delete1(${vo.transitInfo.gid})}"/></th>
								</tr>
							</#list>
						</tbody>
					</table>
				</div>
				<input type="button" id="deleteAllchoice" value="删除所选" style="display: none;" />
				<div id="barcon" name="barcon" style="margin-left: 200px;font-size:10px"></div>
			</div>
			<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
		</div>


		<script type="text/javascript" charset="UTF-8">
			$(function() {
                //初始化侧边栏
                $(".vertical-nav").verticalnav({
                    speed: 400,
                    align: "left"
                });

                //多选
                $("#checkall").click(function () {
                    $('input[class="isCheck"]').attr("checked", this.checked);
                });
                var $isCheck = $("input[class='isCheck']");
                $isCheck.click(function () {
                    $("#checkall").attr("checked", $isCheck.length == $("input[class='isCheck']:checked").length ? true : false);
                });

                //删除

                function deleteByids(delete_data) {
                    $.dialog({
                        type: 'confirm',
                        contentHtml: '<p style:"magrin:0 auto">确认删除？</p>',
                        onClickOk: function () {
                            $.ajax({
                                url: "TransitAction_deleteTransitInfo",
                                data: {
                                    'selectRows': delete_data
                                },
                                success: function () {
                                    var chrstr = delete_data.split(",");
                                    console.log(chrstr);
                                    console.log($("#transport_row" + chrstr[0]));
                                    for (i = 0; i < chrstr.length; i++) {
                                        $("#transport_row" + chrstr[i]).remove();
                                    }
                                }
                            });
                        }
                    });

                }

                deleteData = function (i) {
                    var st = i;
                    st += ",";
                    deleteByids(st);
                }
                $("#deleteAllchoice").click(function () {
                    delete_data = get_checkbox_data();
                    deleteByids(delete_data);
                });

                function get_checkbox_data() {
                    var data_temp = "";
                    $("input[class='isCheck']:checked").each(function () { // 遍历选中的checkbox
                        data_temp += $(this).val() + ',';
                        console.log(data_temp);
                    });
                    ;
                    return data_temp;
                }
            });
		</script>

	</body>

</html>